package cn.com.zhuxulin.android.demos.bussiness;

import java.util.List;

import android.content.Context;
import android.telephony.CellLocation;
import android.telephony.NeighboringCellInfo;
import android.telephony.TelephonyManager;
 
public class TelephonyInfo {
	private TelephonyManager mTManager = null;
	private Context context = null;
	private int callState = 0;
	private CellLocation cellLocation = null;
	private int dataActivity = 0;
	private int dataState = 0;
	private String deviceId = null;
	private String deviceSoftwareVersion = null;
	private String line1Number = null;
	private List<NeighboringCellInfo> neighboringCellInfo = null;
	private String networkCountryIso = null;
	private String networkOperator = null;
	private String networkOperatorName = null;
	private int networkType = 0;
	private int phoneType = 0;
	private String simCountryIso = null;
	private String simOperator = null;
	private String simOperatorName = null;
	private String simSerialNumber = null;
	private int simState = 0;
	private String subscriberId = null;
	private String voiceMailAlphaTag = null;
	private String voiceMailNumber = null;

	public TelephonyInfo(Context context) {
		this.context = context;
		mTManager = (TelephonyManager) this.context
				.getSystemService(Context.TELEPHONY_SERVICE);
		setAllInfo();
	}

	private void setAllInfo() {
		callState = mTManager.getCallState();
		cellLocation = mTManager.getCellLocation();
		dataActivity = mTManager.getDataActivity();
		dataState = mTManager.getDataState();
		deviceId = mTManager.getDeviceId();
		deviceSoftwareVersion = mTManager.getDeviceSoftwareVersion();
		line1Number = mTManager.getLine1Number();
		neighboringCellInfo = mTManager.getNeighboringCellInfo();
		networkCountryIso = mTManager.getNetworkCountryIso();
		networkOperator = mTManager.getNetworkOperator();
		networkOperatorName = mTManager.getNetworkOperatorName();
		networkType = mTManager.getNetworkType();
		phoneType = mTManager.getPhoneType();
		simCountryIso = mTManager.getSimCountryIso();
		simOperator = mTManager.getSimOperator();
		simOperatorName = mTManager.getSimOperatorName();
		simSerialNumber = mTManager.getSimSerialNumber();
		simState = mTManager.getSimState();
		subscriberId = mTManager.getSubscriberId();
		voiceMailAlphaTag = mTManager.getVoiceMailAlphaTag();
		voiceMailNumber = mTManager.getVoiceMailNumber();
	}
	public String getAllInfo() {
		return "AllTelephonyMangerInfo\n mTManager=" + mTManager + " \ncontext="
				+ context + " \ncallState=" + callState + " \ncellLocation="
				+ cellLocation + " \ndataActivity=" + dataActivity
				+ " \ndataState=" + dataState + " \ndeviceId=" + deviceId
				+ " \ndeviceSoftwareVersion=" + deviceSoftwareVersion
				+ " \nline1Number=" + line1Number + " \nneighboringCellInfo="
				+ neighboringCellInfo + " \nnetworkCountryIso="
				+ networkCountryIso + " \nnetworkOperator=" + networkOperator
				+ " \nnetworkOperatorName=" + networkOperatorName
				+ " \nnetworkType=" + networkType + " \nphoneType=" + phoneType
				+ " \nsimCountryIso=" + simCountryIso + " \nsimOperator="
				+ simOperator + " \nsimOperatorName=" + simOperatorName
				+ " \nsimSerialNumber=" + simSerialNumber + " \nsimState="
				+ simState + " \nsubscriberId=" + subscriberId
				+ " \nvoiceMailAlphaTag=" + voiceMailAlphaTag
				+ " \nvoiceMailNumber=" + voiceMailNumber ;
	}
}
